import http from "@/api";

import { ResPage } from "@/api/interface";

import { WorkerEntity, WorkerVo, WorkerWeekCntEntity, WorkerCompanyEntity } from "@/biz/interface/WorkerType";

import { ModuleMainUrl } from "..";

const moduleUrl = ModuleMainUrl;

// * 获取工友列表
export const getWorkerVoListApi = (params: {}) => {
  return http.post<ResPage<WorkerVo>>(moduleUrl + `/cpyswk/polvolist`, params);
};

// * 新增工友接口
export const saveWorkerApi = (worker: WorkerEntity) => {
  return http.post(moduleUrl + `/cpyswk/polsave`, worker);
};

// * 工友详情接口
export const getWorkerInfoApi = (params: { id: string }) => {
  return http.post<WorkerEntity>(moduleUrl + `/cpyswk/wkinfo`, params);
};

// * 工友最近活跃度接口
export const getWorkerWeekCntInfoApi = (params: { workerId: string }) => {
  return http.post<WorkerWeekCntEntity>(moduleUrl + `/cpyswk/wkweekcnt`, params);
};

// * 工友和企业关系接口
export const getWorkerCompanyApi = (params: { workerId: string }) => {
  return http.post<WorkerCompanyEntity>(moduleUrl + `/cpyswk/wkcpy`, params);
};

// * 工友和企业关系接口
export const getWorkerApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyswk/getwk`, params);
};
